const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}

/**
 * 生成指定范围数组
 * 带单位
 * @param {开始} start 
 * @param {结束} end 
 * @param {单位拼接} unit 
 */
function range_list(start,end ,unit='') {
  var _self = this;
  var length = end - start +1;
  var step = start - 1;
  return Array.apply(null,{length:length}).map(function (v,i){step++;return step + unit;});
}

function splic_list(sp='') {
  
}


function is_dict_elemt(e){
  for(var v in e){
    return true
  }
  return false
}
module.exports = {
  formatTime: formatTime,
  range_list,
  is_dict_elemt
}

